package day13;

import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class Teacher {
    private String name;
    private int age;
    public Teacher(){

    }

    public Teacher(String name, int age) throws AgeException {
        this.name = name;
        //this.age = age;
        setAge(age);
    }
    public void selfIntro(){
        System.out.println("老师叫"+name+",今年"+age+"岁了");
    }
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age)throws AgeException {
        if(age<22||age>100)
            throw new AgeException("这个年龄["+age+"]有问题");

        this.age = age;
    }
    public void calcDiv(){
        Scanner a=new Scanner(System.in);
        try {
            int i=a.nextInt();
            int j=a.nextInt();
            int c=i/j;
            System.out.println(c);
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException(e);//
        }
    }
}
